package com.gongpingjialoan.adapter.car;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.gongpingjialoan.R;
import com.gongpingjialoan.activity.car.CarBuyDetailActivity;
import com.gongpingjialoan.activity.car.DiscountDetailActivity;
import com.gongpingjialoan.activity.car.RecomendDiscountFragment;
import com.gongpingjialoan.bean.car.RecomendCarBean;
import com.gongpingjialoan.utility.AbStrUtil;
import com.gongpingjialoan.utility.Utils;
import com.zhy.view.flowlayout.FlowLayout;
import com.zhy.view.flowlayout.TagAdapter;
import com.zhy.view.flowlayout.TagFlowLayout;

import java.text.DecimalFormat;
import java.util.List;

/**
 * Created by Administrator on 2015/12/11.
 */
public class RecomendDiscountAdapter extends RecyclerView.Adapter implements View.OnClickListener {

    private static final int CHESHI = 0;
    private static final int DISCOUNT = 1;
    private static final int FOOT = 2;

    private List<RecomendCarBean> recomendCarBeans;

    private LayoutInflater mLayoutInflater;

    private RecomendDiscountFragment fragment;

    private Context mContext;

    private ForegroundColorSpan bule;

    private int size = 1;

    private DecimalFormat df = new DecimalFormat("0.0000");

    private DecimalFormat df1 = new DecimalFormat("0.00");


    //数据类型(好车推荐或者猜你喜欢)
    String type;


    public RecomendDiscountAdapter(List<RecomendCarBean> recomendCarBeans, RecomendDiscountFragment recomendDiscountFragment) {
        this.recomendCarBeans = recomendCarBeans;
        this.fragment = recomendDiscountFragment;
        this.mContext = recomendDiscountFragment.getActivity();
        this.bule = new ForegroundColorSpan(mContext.getResources().getColor(R.color.button_normal_color));
        this.mLayoutInflater = LayoutInflater.from(mContext);
    }

    public void setType(String type) {
        this.type = type;
    }

    public void setSize(int size) {
        this.size = size;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view;
        if (viewType == RecomendDiscountAdapter.DISCOUNT) {
            view = mLayoutInflater.inflate(R.layout.recommend_daojishi_item, parent, false);
            return new DiscountViewHolder(view);
        } else if (viewType == RecomendDiscountAdapter.CHESHI) {
            view = mLayoutInflater.inflate(R.layout.recommend_discount_item, parent, false);
            return new ViewHolder(view);
        } else {
            view = mLayoutInflater.inflate(R.layout.recommend_discount_footview, parent, false);
            return new FootViewHolder(view);
        }
    }

    @Override
    public int getItemViewType(int position) {
        if (recomendCarBeans.size() == 0) {
            return 0;
        }
        if ("promo_car".equals(recomendCarBeans.get(position).getRecommend_type())) {
            return RecomendDiscountAdapter.DISCOUNT;
        } else if ("car_source".equals(recomendCarBeans.get(position).getRecommend_type())) {
            return RecomendDiscountAdapter.CHESHI;
        } else {
            return RecomendDiscountAdapter.FOOT;
        }
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        if (holder instanceof ViewHolder) {
            initCheshiView((ViewHolder) holder, position);
        } else if (holder instanceof DiscountViewHolder) {
            initDiscountView((DiscountViewHolder) holder, position);
        } else if (holder instanceof FootViewHolder) {
            FootViewHolder footViewHolder = (FootViewHolder) holder;

            if ("猜你喜欢".equals(type)) {
                footViewHolder.cheshiTextView.setText("再来一组");
                footViewHolder.titleTextView.setText("您已看完本组猜你喜欢\n能赏个好评吗?");
            } else {
                footViewHolder.cheshiTextView.setText("再看一遍");
                footViewHolder.titleTextView.setText("您已看完本组好车推荐\n能赏个好评吗?");
            }


//            footViewHolder.cheshiTextView.setOnClickListener();
        }

    }


    private void initDiscountView(final DiscountViewHolder holder, int position) {
        final RecomendCarBean recomendCarBean = recomendCarBeans.get(position);
        Glide.with(fragment).load(recomendCarBean.getImage_urls()).placeholder(R.drawable.car_loading).centerCrop().into(holder.mImageView);

        if (Utils.isLing(recomendCarBean.getEval_price())) {
            holder.evalTextView.setText("");
        } else {
            String comparePrice = "";
            int length = 0;
            double priceCompare = AbStrUtil.get2Double(Double.parseDouble(recomendCarBean.getPromo_price()) - Double.parseDouble(recomendCarBean.getEval_price()));
            if (priceCompare < 0) {
                double priceCompare1 = -priceCompare;
                comparePrice = "(低于公平价估值" + priceCompare1 + "万)";
                length = (priceCompare1 + "万").length();
            } else if (priceCompare > 0) {
                comparePrice = "(高于公平价估值" + priceCompare + "万)";
                length = (priceCompare + "万").length();
            }
            if (TextUtils.isEmpty(comparePrice)) {
                holder.evalTextView.setText("与公平价估值一致");
            } else {
                holder.evalTextView.setText(Utils.changeColor(mContext, comparePrice, 8, 8 + length, R.color.text_orange_dark));
            }
        }
        holder.descriptionTextView.setText(recomendCarBean.getTitle());
        holder.domainTextView.setText(recomendCarBean.getDomain());
        holder.car_priceTextView.setText(recomendCarBean.getPromo_price());
        holder.mile_timeTextView.setText(recomendCarBean.getYear() + "年" + recomendCarBean.getMonth() + "月上牌/行驶" + recomendCarBean.getMile() + "万公里");
        int size = recomendCarBean.getAppoint_count().length();
        String title = "已有" + recomendCarBean.getAppoint_count() + "人预约";
        SpannableStringBuilder builder = new SpannableStringBuilder(title);
        builder.setSpan(bule, 2, 2 + size, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        holder.domainTextView.setText(builder);
        holder.mainLinearLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(mContext, DiscountDetailActivity.class);
                intent.putExtra("typevalue", recomendCarBean.getPromo_id());
                intent.putExtra("recomend", true);
                mContext.startActivity(intent);
                fragment.setSelectRecomendCarBean(recomendCarBean);
            }
        });
        List<RecomendCarBean.OtherCarBean> otherCarBeans = recomendCarBean.getOther_plat_price();
        int other_size = otherCarBeans.size();
        for (int i = 0; i < other_size; i++) {
            int imageId = otherCarBeans.get(i).getUri();
            if (imageId == 0) {
                imageId = R.drawable.qita;
            }
            if (i == 0) {
                holder.fristImageView.setImageResource(imageId);
                if (TextUtils.isEmpty(otherCarBeans.get(i).getPrice())) {
                    holder.fristImageView.setAlpha(0.6f);
                    holder.fristTextView.setText("—");
                } else {
                    holder.fristImageView.setAlpha(1f);
                    holder.fristTextView.setText(otherCarBeans.get(i).getPrice() + "万元");
                }
            }
            if (i == 1) {
                holder.secondImageView.setImageResource(imageId);
                if (TextUtils.isEmpty(otherCarBeans.get(i).getPrice())) {
                    holder.secondImageView.setAlpha(0.6f);
                    holder.secondTextView.setText("—");
                } else {
                    holder.secondImageView.setAlpha(1f);
                    holder.secondTextView.setText(otherCarBeans.get(i).getPrice() + "万元");
                }
            }
            if (i == 2) {
                holder.thirdImageView.setImageResource(imageId);
                if (TextUtils.isEmpty(otherCarBeans.get(i).getPrice())) {
                    holder.thirdImageView.setAlpha(0.6f);
                    holder.thirdTextView.setText("—");
                } else {
                    holder.thirdImageView.setAlpha(1f);
                    holder.thirdTextView.setText(otherCarBeans.get(i).getPrice() + "万元");
                }
            }
        }
        if ("0".equals(recomendCarBean.getCut_price())) {
            holder.cutdownLinearLayout.setVisibility(View.GONE);
        } else {
            holder.cutdownLinearLayout.setVisibility(View.VISIBLE);
            int cut_price = Integer.parseInt(recomendCarBean.getCut_price());
            if (cut_price > 0) {
                holder.cut_price_TextView.setText(cut_price + "元");
                holder.jiang_textTextView.setText("已降");
            } else {
                holder.cut_price_TextView.setText(Math.abs(cut_price) + "元");
                holder.jiang_textTextView.setText("已涨");
            }

        }


        if ("认证商家".equals(recomendCarBean.getDealer_tag())) {
            holder.renzhengTextView.setVisibility(View.VISIBLE);
        } else {
            holder.renzhengTextView.setVisibility(View.GONE);
        }

        if (recomendCarBean.is_appointed()) {
            holder.appiontTextView.setVisibility(View.VISIBLE);
        } else {
            holder.appiontTextView.setVisibility(View.GONE);
        }

        long time = Long.parseLong(recomendCarBean.getD_remain_time());
        if (!"0".equals(recomendCarBean.getPromo_total_seconds())) {
            if (time <= 0) {
                recomendCarBean.setD_remain_time(recomendCarBean.getPromo_total_seconds());
                time = Long.parseLong(recomendCarBean.getPromo_total_seconds());
            }
            holder.timelineTextView.setText(Utils.dateDiff(time));
        } else {
            if (time > 0) {
                holder.timelineTextView.setText(Utils.dateDiff(time));
                holder.timelineImageView.setVisibility(View.VISIBLE);
            } else {
                holder.timelineImageView.setVisibility(View.GONE);
                holder.timelineTextView.setText("已结束");
            }
        }

        holder.mGridView.setVisibility(View.GONE);
        holder.mGridView.setAdapter(new TagAdapter<String>(recomendCarBean.getGood_car_tags()) {
            @Override
            public View getView(FlowLayout parent, int position, String s) {
                TextView tv = (TextView) mLayoutInflater.inflate(R.layout.discount_tags_layout,
                        holder.mGridView, false);
                tv.setText(s);
                return tv;
            }
        });

        if (recomendCarBean.getLoan_info() != null && recomendCarBean.getLoan_info().getDown_payments() > 0 && recomendCarBean.getLoan_info().getMonthly_payments() > 0) {
            holder.yuefuTextView.setVisibility(View.VISIBLE);
            holder.shoufuTextView.setVisibility(View.VISIBLE);
            String price = df1.format(recomendCarBean.getLoan_info().getDown_payments() / 10000d);
            String sf = "首付" + price + "万,";
            holder.shoufuTextView.setText(Utils.changeColor(mContext, sf, 2, 2 + price.length(), R.color.text_orange_dark));
            String price1 = recomendCarBean.getLoan_info().getMonthly_payments() + "";
            String sf1 = "月供" + price1 + "元 (" + recomendCarBean.getLoan_info().getMonths() + "期)";
            holder.yuefuTextView.setText(Utils.changeColor(mContext, sf1, 2, 2 + price1.length(), R.color.text_orange_dark));

        } else {
            holder.yuefuTextView.setVisibility(View.GONE);
            holder.shoufuTextView.setVisibility(View.GONE);
        }


    }


    private void initCheshiView(final ViewHolder holder, int position) {
        final RecomendCarBean recomendCarBean = recomendCarBeans.get(position);
        if (Utils.isLing(recomendCarBean.getEval_price())) {
            holder.evalTextView.setText("");
        } else {
            String comparePrice = "";
            int length = 0;
            double priceCompare = AbStrUtil.get2Double(Double.parseDouble(recomendCarBean.getPrice()) - Double.parseDouble(recomendCarBean.getEval_price()));
            if (priceCompare < 0) {
                double priceCompare1 = -priceCompare;
                comparePrice = "(低于公平价估值" + priceCompare1 + "万)";
                length = (priceCompare1 + "万").length();
            } else if (priceCompare > 0) {
                comparePrice = "(高于公平价估值" + priceCompare + "万)";
                length = (priceCompare + "万").length();
            }
            if (TextUtils.isEmpty(comparePrice)) {
                holder.evalTextView.setText("与公平价估值一致");
            } else {
                holder.evalTextView.setText(Utils.changeColor(mContext, comparePrice, 8, 8 + length, R.color.text_orange_dark));
            }
        }

        Glide.with(fragment).load(recomendCarBean.getImage_urls()).placeholder(R.drawable.car_loading).centerCrop().into(holder.mImageView);
        holder.descriptionTextView.setText(recomendCarBean.getTitle());
        holder.domainTextView.setText(recomendCarBean.getDomain());
        holder.car_priceTextView.setText(recomendCarBean.getPrice());
        holder.mile_timeTextView.setText(recomendCarBean.getYear() + "年" + recomendCarBean.getMonth() + "月上牌/行驶" + recomendCarBean.getMile() + "万公里");
        if (recomendCarBean.getTags().contains("无大事故")) {
            holder.tv_noaccidentTextView.setVisibility(View.VISIBLE);
        } else {
            holder.tv_noaccidentTextView.setVisibility(View.GONE);
        }
        if (recomendCarBean.getTags().contains("可退换")) {
            holder.tv_exchangeTextView.setVisibility(View.VISIBLE);
        } else {
            holder.tv_exchangeTextView.setVisibility(View.GONE);
        }
        if (recomendCarBean.getTags().contains("质保")) {
            holder.tv_safeguardTextView.setVisibility(View.VISIBLE);
        } else {
            holder.tv_safeguardTextView.setVisibility(View.GONE);
        }
        if (recomendCarBean.getTags().contains("先赔付")) {
            holder.tv_compensateTextView.setVisibility(View.VISIBLE);
        } else {
            holder.tv_compensateTextView.setVisibility(View.GONE);
        }

        //            当前标价15万，未降过价（只有首次标价 or 首次标价=最低标价）
//            当前标价15万，可降价0.5万（当前标价>=首次标价 and 当前标价>最低标价）
//            当前标价15万，已降价0.5万（当前标价<首次标价 and 当前标价=最低标价）
//            当前标价15万，已降价0.5万，还可降0.1万（当前标价<首次标价 and 当前标价>最低标价）
        int price_text;
        if (TextUtils.isEmpty(recomendCarBean.getLast_price())) {
            holder.down_price_linear.setVisibility(View.GONE);
//            cut_priceTextView.setText("首次标价");
        } else {
            double current_p = Double.valueOf(recomendCarBean.getPrice());
            double origin_p = Double.valueOf(recomendCarBean.getOrigin_price());
            double lowest_p = Double.valueOf(recomendCarBean.getLowest_price());

            holder.down_price_linear.setVisibility(View.GONE);
            if (current_p >= origin_p && current_p > lowest_p) {
                holder.down_price_linear.setVisibility(View.VISIBLE);
                price_text = (int) (Double.valueOf(df.format(current_p - lowest_p)) * 10000);
                holder.zhang_jiangTextView.setText("可降");
                holder.cut_price_idTextView.setText(price_text + "元");
                holder.zhang_jiangTextView.setBackgroundResource(R.drawable.yi_jiang_green);
                holder.zhang_jiangTextView.setTextColor(mContext.getResources().getColor(R.color.new_color));
                holder.cut_price_idTextView.setBackgroundResource(R.drawable.jiang_green);
            }
            if (current_p < origin_p && current_p == lowest_p) {
                holder.down_price_linear.setVisibility(View.VISIBLE);
                price_text = (int) (Double.valueOf(df.format(origin_p - current_p)) * 10000);
                holder.zhang_jiangTextView.setText("已降");
                holder.cut_price_idTextView.setText(price_text + "元");
                holder.zhang_jiangTextView.setBackgroundResource(R.drawable.ke_jiang);
                holder.zhang_jiangTextView.setTextColor(mContext.getResources().getColor(R.color.c27));
                holder.cut_price_idTextView.setBackgroundResource(R.drawable.ke_jiang_bg);
            }

            if (current_p < origin_p && current_p > lowest_p) {
                holder.down_price_linear.setVisibility(View.VISIBLE);
                price_text = (int) (Double.valueOf(df.format(current_p - lowest_p)) * 10000);
                holder.zhang_jiangTextView.setText("可降");
                holder.cut_price_idTextView.setText(price_text + "元");
                holder.zhang_jiangTextView.setBackgroundResource(R.drawable.yi_jiang_green);
                holder.zhang_jiangTextView.setTextColor(mContext.getResources().getColor(R.color.new_color));
                holder.cut_price_idTextView.setBackgroundResource(R.drawable.jiang_green);
            }
        }
        holder.mainLinearLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(mContext, CarBuyDetailActivity.class);
                intent.putExtra("typevalue", String.valueOf(recomendCarBean.getId()));
                intent.putExtra("type", "recomendcar");
                intent.putExtra("from", "goodcar");
                mContext.startActivity(intent);
            }
        });

        if ("认证商家".equals(recomendCarBean.getDealer_tag())) {
            holder.renzhengTextView.setVisibility(View.VISIBLE);
        } else {
            holder.renzhengTextView.setVisibility(View.GONE);
        }

        List<RecomendCarBean.OtherCarBean> otherCarBeans = recomendCarBean.getOther_plat_price();
        if (otherCarBeans != null) {
            int other_size = otherCarBeans.size();
            for (int i = 0; i < other_size; i++) {
                int imageId = otherCarBeans.get(i).getUri();
                if (imageId == 0) {
                    imageId = R.drawable.qita;
                }
                if (i == 0) {
                    holder.fristImageView.setImageResource(imageId);
                    if (TextUtils.isEmpty(otherCarBeans.get(i).getPrice())) {
                        holder.fristImageView.setAlpha(0.6f);
                        holder.fristTextView.setText("—");
                    } else {
                        holder.fristImageView.setAlpha(1f);
                        holder.fristTextView.setText(otherCarBeans.get(i).getPrice() + "万元");
                    }
                }
                if (i == 1) {
                    holder.secondImageView.setImageResource(imageId);
                    if (TextUtils.isEmpty(otherCarBeans.get(i).getPrice())) {
                        holder.secondImageView.setAlpha(0.6f);
                        holder.secondTextView.setText("—");
                    } else {
                        holder.secondImageView.setAlpha(1f);
                        holder.secondTextView.setText(otherCarBeans.get(i).getPrice() + "万元");
                    }
                }
                if (i == 2) {
                    holder.thirdImageView.setImageResource(imageId);
                    if (TextUtils.isEmpty(otherCarBeans.get(i).getPrice())) {
                        holder.thirdImageView.setAlpha(0.6f);
                        holder.thirdTextView.setText("—");
                    } else {
                        holder.thirdImageView.setAlpha(1f);
                        holder.thirdTextView.setText(otherCarBeans.get(i).getPrice() + "万元");
                    }
                }
            }
        }
    }


    @Override
    public int getItemCount() {
        return recomendCarBeans.size();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.cheshi_id:
                fragment.gotoCheshi();
                break;
            case R.id.haoping_id:
                fragment.haoping();
                break;
            default:
                break;
        }

    }


    public static class ViewHolder extends RecyclerView.ViewHolder {
        private ImageView mImageView;
        private TextView mile_timeTextView;
        private TextView descriptionTextView;
        private TextView domainTextView;
        private TextView tv_noaccidentTextView;
        private TextView tv_exchangeTextView;
        private TextView tv_safeguardTextView;
        private TextView tv_compensateTextView;
        private TextView car_priceTextView;
        private TextView fristTextView;
        private TextView secondTextView;
        private TextView thirdTextView, evalTextView;
        private ImageView fristImageView;
        private ImageView secondImageView;
        private ImageView thirdImageView;
        private LinearLayout mainLinearLayout, down_price_linear;
        private TextView renzhengTextView, zhang_jiangTextView, cut_price_idTextView;

        public ViewHolder(View itemView) {
            super(itemView);
            evalTextView = (TextView) itemView.findViewById(R.id.eval_price);
            renzhengTextView = (TextView) itemView.findViewById(R.id.renzheng_id);
            mainLinearLayout = (LinearLayout) itemView.findViewById(R.id.main);
            down_price_linear = (LinearLayout) itemView.findViewById(R.id.yijiang_linear);
            mImageView = (ImageView) itemView.findViewById(R.id.imageView);
            descriptionTextView = (TextView) itemView.findViewById(R.id.description);
            zhang_jiangTextView = (TextView) itemView.findViewById(R.id.zhang_jiang);
            cut_price_idTextView = (TextView) itemView.findViewById(R.id.cut_price_id);
            domainTextView = (TextView) itemView.findViewById(R.id.domain);
            tv_noaccidentTextView = (TextView) itemView.findViewById(R.id.tv_noaccident);
            tv_exchangeTextView = (TextView) itemView.findViewById(R.id.tv_exchange);
            tv_safeguardTextView = (TextView) itemView.findViewById(R.id.tv_safeguard);
            tv_compensateTextView = (TextView) itemView.findViewById(R.id.tv_compensate);
            mile_timeTextView = (TextView) itemView.findViewById(R.id.time_mile_id);
            car_priceTextView = (TextView) itemView.findViewById(R.id.car_price);
            fristImageView = (ImageView) itemView.findViewById(R.id.frist_img);
            secondImageView = (ImageView) itemView.findViewById(R.id.second_img);
            thirdImageView = (ImageView) itemView.findViewById(R.id.third_img);
            fristTextView = (TextView) itemView.findViewById(R.id.frist_price);
            secondTextView = (TextView) itemView.findViewById(R.id.second_price);
            thirdTextView = (TextView) itemView.findViewById(R.id.third_price);
        }
    }


    public static class DiscountViewHolder extends RecyclerView.ViewHolder {
        private ImageView mImageView;
        private TextView mile_timeTextView, evalTextView;
        private TextView descriptionTextView;
        private TextView domainTextView;
        private TextView car_priceTextView;
        private TextView timelineTextView;
        private ImageView timelineImageView;
        private TextView fristTextView;
        private TextView secondTextView;
        private TextView thirdTextView;
        private ImageView fristImageView;
        private ImageView secondImageView;
        private ImageView thirdImageView;
        private LinearLayout mainLinearLayout;
        private LinearLayout cutdownLinearLayout;
        private TextView renzhengTextView;
        private TextView appiontTextView;
        private TextView cut_price_TextView;
        private TextView jiang_textTextView;
        private TagFlowLayout mGridView;
        private TextView shoufuTextView;
        private TextView yuefuTextView;

        public DiscountViewHolder(View itemView) {
            super(itemView);
            evalTextView = (TextView) itemView.findViewById(R.id.eval_price);
            jiang_textTextView = (TextView) itemView.findViewById(R.id.jiang_text);
            cutdownLinearLayout = (LinearLayout) itemView.findViewById(R.id.yijang_linear);
            mGridView = (TagFlowLayout) itemView.findViewById(R.id.gridView);
            cut_price_TextView = (TextView) itemView.findViewById(R.id.cut_price_id);
            appiontTextView = (TextView) itemView.findViewById(R.id.appiont_id);
            renzhengTextView = (TextView) itemView.findViewById(R.id.renzheng_id);
            mainLinearLayout = (LinearLayout) itemView.findViewById(R.id.main);
            mImageView = (ImageView) itemView.findViewById(R.id.imageView);
            descriptionTextView = (TextView) itemView.findViewById(R.id.description);
            domainTextView = (TextView) itemView.findViewById(R.id.domain);
            timelineTextView = (TextView) itemView.findViewById(R.id.time_dealine);
            timelineImageView = (ImageView) itemView.findViewById(R.id.img_d);
            mile_timeTextView = (TextView) itemView.findViewById(R.id.time_mile_id);
            car_priceTextView = (TextView) itemView.findViewById(R.id.car_price);
            fristImageView = (ImageView) itemView.findViewById(R.id.frist_img);
            secondImageView = (ImageView) itemView.findViewById(R.id.second_img);
            thirdImageView = (ImageView) itemView.findViewById(R.id.third_img);
            fristTextView = (TextView) itemView.findViewById(R.id.frist_price);
            secondTextView = (TextView) itemView.findViewById(R.id.second_price);
            thirdTextView = (TextView) itemView.findViewById(R.id.third_price);
            yuefuTextView = (TextView) itemView.findViewById(R.id.yuefu);
            shoufuTextView = (TextView) itemView.findViewById(R.id.shoufu);
        }
    }


    public class FootViewHolder extends RecyclerView.ViewHolder {

        private TextView cheshiTextView;
        private TextView haopingTextView;
        private TextView titleTextView;

        public FootViewHolder(View itemView) {
            super(itemView);
            titleTextView = (TextView) itemView.findViewById(R.id.text);
            cheshiTextView = (TextView) itemView.findViewById(R.id.cheshi_id);
            haopingTextView = (TextView) itemView.findViewById(R.id.haoping_id);
            cheshiTextView.setOnClickListener(RecomendDiscountAdapter.this);
            haopingTextView.setOnClickListener(RecomendDiscountAdapter.this);
        }
    }
}
